package com.example.activityproject201202;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class RedAct extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.red_activity_layout);
        Log.i("RedAct","对象名称："+this);
        Intent intent = getIntent();
        String value = intent.getStringExtra("to_red_key");
        Log.i("RedAct","收的值为："+value);
        Button to_red_act_bt = findViewById(R.id.to_red_act_bt);
        to_red_act_bt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent1 = new Intent(RedAct.this,RedAct.class);
                startActivity(intent1);
            }
        });

        Button to_one_act_bt = findViewById(R.id.to_one_act_bt);
        to_one_act_bt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent2 = new Intent(RedAct.this, OneActivity.class);
                startActivity(intent2);
            }
        });

        Button to_main_act_bt = findViewById(R.id.to_main_act_bt);
        to_main_act_bt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent3 = new Intent(RedAct.this, MainActivity.class);
                intent3.putExtra("msg_key","form redact");
                startActivity(intent3);
            }
        });

    }
}
